package com.xxx.control.utils;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

public class DateUtils {

    private static final String dateFormat = "yyyy-MM-dd HH:mm:ss";

    public static String dateToStrFormat(Date date, String format) {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat(format, Locale.getDefault());
        return simpleDateFormat.format(date);
    }

    public static String getCurrentDate() {
        return getCurrentDate(dateFormat);
    }


    public static String getCurrentDate(String format) {
        Date date = new Date(System.currentTimeMillis());
        return dateToStrFormat(date, format);
    }

}
